<%--
  Created by IntelliJ IDEA.
  User: 李昭富
  Date: 2024/5/31
  Time: 16:45
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8" language="java" %>
<%@ page import = "java.sql.*" %>
<%@ include file = "jdbc.jsp" %>
<%
    //1、获得连接
    Connection conn=getConnection();
//2、建立Statement对象
    Statement stmt=conn.createStatement();
//3、生成sql
    int id=Integer.parseInt(request.getParameter("id"));
    String nickname=request.getParameter("nickname");
    int sex=Integer.parseInt(request.getParameter("sex"));
//表单验证
    String sql="update user set nickname='" + nickname + "',sex=" + sex + "  where id=" + id;
//4、执行Sql
    stmt.executeUpdate(sql);
//5、处理结果
    response.sendRedirect("list.jsp");
%>
